package utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

public class BasicFileReader {

	BufferedReader bufferedReader;

	public BasicFileReader(String filename) {
		try {
			bufferedReader = new BufferedReader(new java.io.FileReader(
					new File(filename)));
		} catch (FileNotFoundException e) {
			// e.printStackTrace();
			bufferedReader = null;
		}
	}

	/**
	 * @return null if file cannot be read or if there are no more strings
	 */
	public String readLine() {
		if (bufferedReader == null)
			return null;
		try {
			return bufferedReader.readLine();
		} catch (IOException e) {
			return null;
		}
	}

	public void close() {
		if (bufferedReader != null)
			try {
				bufferedReader.close();
			} catch (IOException e) {
			}
	}
}
